<!--
*Author：DGZ
 *Contact：jiduxiong@dagongzao.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/basproject/basicdata/Bas_Plant.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :details="details"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/basproject/basicdata/Bas_Plant.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        name:'Bas_Plant',
        setup() {
            const table = ref({
                key: "PlantId",
                footer: "Foots",
                cnName: "工厂管理",
                name: "basicdata/Bas_Plant",
                newTabEdit: false,
                url: "/Bas_Plant/",
                sortName: "PlantCode,PlantName,CreateTime"
            });
            const editFormFields = ref({"PlantCode":"","PlantName":"","CompanyId":"","PlantDesc":"","Enabled":"","Remarks":""});
            const editFormOptions = ref([[{"dataKey":"BASE_Company","data":[],"title":"归属公司","field":"CompanyId","type":"select"},
                               {"title":"工厂编号","required":true,"field":"PlantCode"},
                               {"title":"工厂名称","required":true,"field":"PlantName"}],
                              [{"title":"工厂描述","field":"PlantDesc","type":"textarea"},
                               {"dataKey":"enabled","data":[],"title":"启用","field":"Enabled","type":"switch"},
                               {"title":"备注","field":"Remarks","type":"textarea"}]]);
            const searchFormFields = ref({"PlantCode":"","PlantName":"","CompanyId":""});
            const searchFormOptions = ref([[{"title":"工厂编号","field":"PlantCode"},{"title":"工厂名称","field":"PlantName"},{"dataKey":"BASE_Company","data":[],"title":"归属公司","field":"CompanyId","type":"select"}]]);
            const columns = ref([{field:"PlantCode",title:"工厂编号",type:"string",link:true,width:120,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"PlantName",title:"工厂名称",type:"string",width:150,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"Company.CompanyCode",title:"公司代码",type:"string",width:90,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"Company.CompanyName",title:"公司名称",type:"string",width:150,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"PlantId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"PlantDesc",title:"工厂描述",type:"string",width:150,showOverflowTooltip:true,align:"left"},
                       {field:"CompanyId",title:"归属公司",type:"bigint",bind:{ key:"BASE_Company",data:[]},width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Enabled",title:"启用",type:"sbyte",bind:{ key:"enabled",data:[]},width:110,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"}]);
            const detail = ref(  {
                    cnName: "工厂行事历",
                    table: "Bas_PlantCalender",
                    columns: [{field:"PlantCalendarId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"PlantId",title:"工厂ID",type:"bigint",width:110,hidden:true,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"CalendarYear",title:"日历年",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"CalendarDate",title:"日期",type:"datetime",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"WorkType",title:"工作模式",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"CalendarWeek",title:"日历周",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"Enabled",title:"启用",type:"sbyte",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,edit:{type:"textarea"},showOverflowTooltip:true,align:"left"}],
                    sortName: "PlantCalendarId",
                    key: "PlantCalendarId"
                                            });
            const details = ref([]);
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
                details
            };
        },
    });
</script>
